import 'package:flutter/material.dart';

///普通跳转传值
class ChuanzhiDemo extends StatefulWidget {
  //可选参数
  final String title;

  //必传required
  final int aid;

  const ChuanzhiDemo({super.key, this.title = '默认title', required this.aid});

  @override
  State<ChuanzhiDemo> createState() => _ChuanzhiDemoState();
}

class _ChuanzhiDemoState extends State<ChuanzhiDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('传递过来的值=' + widget.title),
        centerTitle: true,
      ),
      body: Center(
        child: Text('传递过来的值=${widget.aid}'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          //返回
          Navigator.pop(context);
        },
        child: Icon(Icons.home),
      ),
    );
  }
}
